In conventional technology for correcting image data, when a significant difference between brightness and darkness is detected in a histogram of the image data, or, when many dark pixels are present in the image data, such image data is determined to be underexposed or backlighted, and brightness conversion is performed on the image data to correct it.
Even when many dark pixels are present in the image, if the image is taken of a night scene, the image is not underexposed or backlighted. Accordingly, there is a known technology for determining, in accordance with the number of dark pixels which is in contact with an image rectangular (a contour of a region in which an image is displayed), whether an image is underexposed (an image that needs to be subjected to brightness-conversion correction) or is low key (an image that does not need to be subjected to brightness-conversion) (see International Publication Pamphlet No. WO 2007-072548).
However, the technology for determining whether an image is underexposed or low key, in accordance with the number of dark pixels which is in contact with the image rectangular, may erroneously determine an image to be low key, even when many dark pixels are present in the image rectangular; for example, when the image is obtained by photographing an entire room including a window through which a bright outside scene may be seen from the dark room. As a result, in some cases, image data is not appropriately corrected due to erroneous determination, which is a problem.